<route>
    {
        meta: {
            title: "创建权限组"
        }
    }
</route>

<script setup name="personalExamplePowerAdd">
import useFileStore from '@/store/modules/file'

const router = useRouter()

const fileStore = useFileStore()

const formRef = ref()

const form = ref({
  name: ""
})

const rules = ref({
  name: [
    { required: true, message: "请输入姓名", trigger: "blur" }
  ]
})

function onSubmit() {
  formRef.value.validate(valid => {
    if(valid) {
      fileStore.permissonGroupsAdd(form.value).then(res => {
        ElMessage({
          type: "success",
          message: "新增成功"
        })
        router.push({
          name: "personalExamplePower"
        })
      })
    }
  })
}

</script>

<template>
  <div>
    <page-header title="新增文件权限组"></page-header>
    <page-main>
      <el-row>
        <el-col :md="24" :lg="12">
          <el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
            <el-form-item label="姓名" prop="name">
              <el-input v-model="form.name" placeholder="请输入姓名"></el-input>
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
    </page-main>
    <fixed-action-bar>
      <el-button type="primary" size="large" @click="onSubmit">提交</el-button>
    </fixed-action-bar>
  </div>
</template>